package com.cxm.qyyz.core.http;

import android.webkit.WebSettings;

import com.cxm.qyyz.app.App;
import com.cxm.qyyz.entity.ServerUrlEntity;
import com.cxm.qyyz.entity.response.LoginEntity;

import java.util.HashMap;
import java.util.Map;

import javax.inject.Inject;

import io.reactivex.rxjava3.core.Observable;

public class HttpHelperImpl implements HttpHelper {

    private final DataApi dataApi;

    @Inject
    public HttpHelperImpl(DataApi dataApi) {
        this.dataApi = dataApi;
    }

    @Override
    public Observable<BaseResponse<LoginEntity>> loginByPwd(String account, String password) {
        Map<String, String> map = new HashMap<>();
        map.put("loginName", account);
        map.put("password", password);
        return dataApi.loginByPwd(map, WebSettings.getDefaultUserAgent(App.getInstance()), "");
    }

    @Override
    public Observable<BaseResponse<ServerUrlEntity>> getServerUrl() {
        return dataApi.getServerUrl();
    }


}
